require(['init'], function () {
    var uecontent = UE.getEditor('contenteditor');
    var feedbackeue = UE.getEditor('feedbackeditor');
    var id = location.search.urlToObj().id;
    var type = location.search.urlToObj().type;
    var classeid = location.search.urlToObj().classeid;
    var teacheruid = location.search.urlToObj().teacheruid;
    var scheduleid = location.search.urlToObj().scheduleid;
    var classe = location.search.urlToObj().classe;
    $('.navname').attr('href', './teacher_class_lesson.html?type=' + type + '&classeid=' + classeid + '&classe='+classe+'')
    $('.classname').html(classe)
    //课节信息
    $.ajax({
        url: '/api/schedule/' + scheduleid,
        type: 'get',
        success: function (data) {
            $('.lessonname').html(data.data.name)
        }
    })
    //班级的信息
    $.ajax({
        url: '/api/classe/' + classeid,
        type: 'get',
        success: function (data) {
            console.log(data.data)
        }
    })
    //点击添加
    $("#submit_html").on('click', function () {
        var published = $('[name=published]').prop('checked') ? 1 : 0;
        var title = $('input[name="title"]').val();
        var content = uecontent.getContent();  //做业内容
        var note = feedbackeue.getContent();  //反馈内容
        var arr = {
            published: published,
            title: title,
            content: content,
            note: note,
            teacheruid: teacheruid,
            classeid: classeid,
            classetype: type,
            scheduleid: scheduleid
        };
        if (title != "" && content != "" && note != "") {
            ajaxMethod({
                url: '/api/task/subject',
                type: 'post',
                data: arr,
                success: function (data) {
                    window.location.href = "teacher_class_lesson.html?type=" + type + "&classeid=" + classeid + "&classe=" + classe + "";
                }
            });
        } else {
            return false;
        }

    })
})
